package com.llmcu.source.javase.regrex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 正则使用
 *
 * @author liuling
 * @date 2024/8/31 14:52
 */
public class R00UsageString {
    public static void main(String[] args) {
        String oldStr = "my name is ${name}";
        System.out.println(oldStr.replaceAll("\\$\\{name}","LiuLing"));
        System.out.println(oldStr.replace("name","n"));


        System.out.println(oldStr.matches("[\\w\\s]{11}\\$\\{name}"));

        String[] words = oldStr.split("\\s");
        System.out.println(words.length);
        for (String word : words) {
            System.out.println(word);
        }
    }
}
